package com.hengpeng.itfinbase.persist;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

import com.hengpeng.common.web.annotation.HtmlInput;
import com.hengpeng.common.web.annotation.HtmlInputPattern;
import com.hengpeng.common.web.annotation.HtmlInputType;
import com.hengpeng.itfinbase.en.ActivityStatus;
import com.hengpeng.itfinbase.en.ActivityType;
import com.hengpeng.itfinbase.en.CustomerType;
import com.hengpeng.itfinbase.en.PlatForm;
import com.hengpeng.itfinbase.idAssign.AbstractAssign18IdEntity;

/**
 * 活动信息表
 * 
 * @author weiyuan
 */
@Entity
public class Activity extends AbstractAssign18IdEntity {

    /**
     * 
     */
    private static final long serialVersionUID = -6976803970140937713L;

    /**
     * 活动名称
     */
    @HtmlInput(label = "活动名称", type = HtmlInputType.TEXT, nullable = false, index = 1)
    @Column(length = 200)
    private String activityName;
    /**
     * 活动对应奖品集合
     */
    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name = "activity_reward", joinColumns = { @JoinColumn(name = "activeid") },
    inverseJoinColumns = { @JoinColumn(name = "rewardId") }
    )
    private Set<Reward> rewards = new HashSet<Reward>();// Reward对象的集合

    @Column(length = 20)
    @HtmlInput(label = "活动状态", type = HtmlInputType.SELECT, nullable = false, index = 2, labelProperty = "text")
    @Enumerated(javax.persistence.EnumType.STRING)
    private ActivityStatus status;

    @Column(length = 20)
    @HtmlInput(label = "顾客类型", type = HtmlInputType.SELECT, nullable = false, index = 3, labelProperty = "text")
    @Enumerated(javax.persistence.EnumType.STRING)
    private CustomerType customerType;

    @Column(length = 20)
    @HtmlInput(label = "平台类型", type = HtmlInputType.SELECT, nullable = false, index = 4, labelProperty = "text")
    @Enumerated(javax.persistence.EnumType.STRING)
    private PlatForm platform;

    /**
     * 活动开始时间
     */
    @HtmlInput(label = "活动开始时间", type = HtmlInputType.TEXT,pattern = HtmlInputPattern.DATE, nullable = false, index = 5)
    private Date startDate;

    /**
     * 活动结束时间
     */
    @HtmlInput(label = "活动结束时间", type = HtmlInputType.TEXT,pattern = HtmlInputPattern.DATE, nullable = false, index = 6)
    private Date endDate;

    @Column(length = 20)
    @HtmlInput(label = "活动类型", type = HtmlInputType.SELECT, nullable = false, index = 7, labelProperty = "text")
    @Enumerated(javax.persistence.EnumType.STRING)
    private ActivityType activityType;

    /**
     * 奖励条件值
     */
    @HtmlInput(label = "奖励条件值", type = HtmlInputType.TEXT,pattern=HtmlInputPattern.FLOAT, nullable = false, index = 8)
    @Column(length = 50)
    private BigDecimal conditionVal;

    /**
     * 奖励开始时间
     */
    @HtmlInput(label = "奖励开始时间", type = HtmlInputType.TEXT,pattern = HtmlInputPattern.DATE, nullable = false, index = 6)
    private Date rewardStartDate;

    /**
     * 奖励结束时间
     */
    @HtmlInput(label = "奖励结束时间", type = HtmlInputType.TEXT,pattern = HtmlInputPattern.DATE, nullable = false, index = 6)
    private Date rewardEndDate;

    @Column(length = 10)
    @Enumerated(javax.persistence.EnumType.STRING)
    @HtmlInput(label = "是否参加多级", maxLength = 2, type = HtmlInputType.RADIOBOX, labelProperty = "text", nullable = true, index = 11)
    private BoolValue isMultilevel;

    @Column(length = 10)
    @Enumerated(javax.persistence.EnumType.STRING)
    @HtmlInput(label = "是否支持递增", maxLength = 2, type = HtmlInputType.RADIOBOX, labelProperty = "text", nullable = true, index = 11)
    private BoolValue isIncrease;

    /**
     * 单人奖励上限
     */
    @HtmlInput(label = "单人奖励上限", type = HtmlInputType.TEXT,pattern=HtmlInputPattern.INT, nullable = false, index = 12)
    private Long onePersonRewardLimit;

    /**
     * 总奖励上限
     */
    @HtmlInput(label = "总奖励上限", type = HtmlInputType.TEXT,pattern=HtmlInputPattern.INT, nullable = false, index = 13)
    private Long totalRewardLimit;

    /**
     * 活动限制次数
     */
    @HtmlInput(label = "活动限制次数", type = HtmlInputType.TEXT,pattern=HtmlInputPattern.INT, nullable = false, index = 13)
    private Long activityLimitTimes;

    private Date createTime;

    private Date updateTime;

    public Set<Reward> getRewards() {
        return rewards;
    }

    public void setRewards(Set<Reward> rewards) {
        this.rewards = rewards;
    }

    public ActivityStatus getStatus() {
        return status;
    }

    public void setStatus(ActivityStatus status) {
        this.status = status;
    }

    public CustomerType getCustomerType() {
        return customerType;
    }

    public void setCustomerType(CustomerType customerType) {
        this.customerType = customerType;
    }

    public PlatForm getPlatform() {
        return platform;
    }

    public void setPlatform(PlatForm platform) {
        this.platform = platform;
    }

    public ActivityType getActivityType() {
        return activityType;
    }

    public void setActivityType(ActivityType activityType) {
        this.activityType = activityType;
    }

    public BoolValue getIsMultilevel() {
        return isMultilevel;
    }

    public void setIsMultilevel(BoolValue isMultilevel) {
        this.isMultilevel = isMultilevel;
    }

    public BoolValue getIsIncrease() {
        return isIncrease;
    }

    public void setIsIncrease(BoolValue isIncrease) {
        this.isIncrease = isIncrease;
    }

    public String getActivityName() {
        return activityName;
    }

    public void setActivityName(String activityName) {
        this.activityName = activityName;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public BigDecimal getConditionVal() {
        return conditionVal;
    }

    public void setConditionVal(BigDecimal conditionVal) {
        this.conditionVal = conditionVal;
    }

    public Date getRewardStartDate() {
        return rewardStartDate;
    }

    public void setRewardStartDate(Date rewardStartDate) {
        this.rewardStartDate = rewardStartDate;
    }

    public Date getRewardEndDate() {
        return rewardEndDate;
    }

    public void setRewardEndDate(Date rewardEndDate) {
        this.rewardEndDate = rewardEndDate;
    }

    public Long getOnePersonRewardLimit() {
        return onePersonRewardLimit;
    }

    public void setOnePersonRewardLimit(Long onePersonRewardLimit) {
        this.onePersonRewardLimit = onePersonRewardLimit;
    }

    public Long getTotalRewardLimit() {
        return totalRewardLimit;
    }

    public void setTotalRewardLimit(Long totalRewardLimit) {
        this.totalRewardLimit = totalRewardLimit;
    }

    public Long getActivityLimitTimes() {
        return activityLimitTimes;
    }

    public void setActivityLimitTimes(Long activityLimitTimes) {
        this.activityLimitTimes = activityLimitTimes;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

}
